<?php
/*
 * Created on 28.03.2009
 *
 * To change the template for this generated file go to
 * Window - Preferences - PHPeclipse - PHP - Code Templates
 */
 ini_set('include_path', ini_get('include_path').PATH_SEPARATOR.plugins_path.'/catalog/models/build/classes');

 // load ORM
 require_once 'propel/Propel.php';
 // load infrastructure model
 require_once plugins_path."/catalog/models/infrastructure.php5";
 
 
 class Catalog {
 	
 	static $config;
 	static $infrastructure;
 	
	static function init() {
		self::$config = Config::load(plugins_path.'/catalog/catalog.yaml');

		self::$infrastructure = new Model_Infrastructure(self::$config[infrastructure]);
		
		Propel::init(plugins_path."/catalog/models/build/conf/catalog-conf.php");
	}

	static function config() {
		return self::$config;
	}
	
	static function infrastructure() {
		return self::$infrastructure;
	}
 	
 	static function types() {
 		return self::$config[object_types];
 	}
 	
 	static function cities($country = null) {
 		if(empty($country)) {
 			$country = 1; 
 		}
 		$c = new Criteria();
 		$c->add(CitiesPeer::COUNTRYID,$country); 
 		
 		$res = CitiesPeer::doSelect($c);

 		return $res;
 	}
 	
 }
?>
